home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Add-On
/
Workbench Add-On - Volume 1.iso
/
Gfx
/
Edit
/
TSMorph
/
src
/
rexx
/
Preview.TSM
< prev
next >
Wrap
Text File
|
1995-02-05
|
5KB
|
113 lines
/* example Preview script file for TSMorph */
/* This example renders the frame as a 16 colour */
/* grey scale image, with a resolution of ~128x64 */
/* using the T: directory as a work directory */
/* and then displays the image */
/* $VER: Preview_TSM 3.1 (5.2.95)
*/
/* get arguments */
parse arg Frame " " FileName
/* Frame - current frame number */
/* FileName - Filename of points file */
/* */
/* current Settings have previously been saved in */
/* 'T:TSMorph.prefs' */
/* make rexx the default command host */
address "REXX"
/* add rexxsupport.library if not already present */
/* (required for next() */
if ~(show('L','rexxsupport.library')) then
call addlib('rexxsupport.library',0,-30,0)
/* open input file */
if open('infile',FileName,'r') then do
/* open output file */
if open('outfile','T:TSM.points','w') then do
/* read possible header */
line = readln('infile')
/* write header */
call writeln('outfile','TSMorph 1.2')
if (line = 'TSMorph 1.2') then
/* read over header */
line = readln('infile')
/* read and write input file names */
call writeln('outfile',line)
call writeln('outfile',readln('infile'))
call writeln('outfile',readln('infile'))
call writeln('outfile',readln('infile'))
/* read output name */
call readln('infile')
/* write our output file name */
call writeln('outfile','T:TSM.pic')
/* read and write details */
line = readln('infile')
parse var line "w=" width ",h=" height ",Frames=" frames ",Single=" single ",Start=" start
call writeln('outfile',line)
/* copy rest of file */
do while ~(eof('infile'))
call writeln('outfile',readln('infile'))
end
/* close output file */
call close('outfile')
/* calculate dx and dy parameters */
/* image is then 128x64 minimum resolution */
if (width > 128) then
dx = trunc((width - 128) / 128)
else
dx = 0
if (height > 64) then
dy = trunc((height - 64) / 64)
else
dy = 0
/* copy points for anim warps/morphs */
if (single = 2) | (single = 3) then
if (Frame < 10) then
address command 'copy "'FileName'.00'Frame'" T:TSM.points.00'Frame
else
if (Frame < 100) then
address command 'copy "'FileName'.0'Frame'" T:TSM.points.0'Frame
else
address command 'copy "'FileName'.'Frame'" T:TSM.points.'Frame
/* Write Prescript */
/* This only renders the requested frame */
if open('pre','T:Prescript.TSM','w') then do
/* Heading comment */
call writeln('pre','/* Preview Prescript */')
/* get arguments */
call writeln('pre','parse arg Base')
/* get frame number, from 1 */
/* see Prescript.TSM for more info */
call writeln('pre','f = C2D(IMPORT(D2C(STRIP(Base),4),4),4)')
/* get start frame number */
call writeln('pre','s = C2D(IMPORT(D2C(STRIP(Base)+76,4),4),4)')
/* if it is not our frame then */
call writeln('pre','if ~((f+s-1) = 'Frame') then')
/* do not produce this frame */
/* see Prescript.TSM for more info */
call writeln('pre',' call EXPORT(D2C(STRIP(Base)+40,4),D2C(0,4),4)')
/* stop */
call writeln('pre','exit')
/* close prescript file */
call close('pre')
/* call TSMorph-render to render frame */
/* this saves BW16 image */
address command 'TSMorph:TSMorph-render INTEGER=YES FILES=T:TSM.points POSTSCRIPT=OFF CREATEICONSR=NO ANTIALIAS=NO DX='dx' DY='dy' PRESCRIPT=T:Prescript SAVEFORMAT=BW16 SETTINGS=T:TSMorph.prefs'
/* check OS version and then */
/* display image using relevant command */
execbase = c2d(NEXT('00000004'x))
version = c2d(IMPORT(d2c(execbase+20,4),4))/65536
if (version < 39) then
address command 'sys:utilities/Display T:TSM.pic'
else
address command 'sys:utilities/MultiView T:TSM.pic SCREEN'
end
end
/* close input file */
call close('infile')
end
/* the end! */
exit